package edu.ahut.spring;

import edu.ahut.spring.pojo.Product;
import org.junit.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import java.util.logging.Logger;


public class TestSpringIOC2 {
    @Test
    public void testSpringIOC() {


        ApplicationContext context = new ClassPathXmlApplicationContext(
                new String[]{"applicationContext.xml"});

        Product p = (Product) context.getBean("p");
        Logger.getLogger(getClass().getName()).info(p.getName());
        Logger.getLogger(getClass().getName()).info(p.getCategory().getName());
    }
}
